import { ratedApi } from "@/utils/api";

// 列表模块
const ratedModule = {
  namespaced: true,
  state: {
    // 受欢迎的列表
    ratedList: [],
  },
  mutations: {
    // 最受欢迎的数据的改变
    getRatedList(state, payload) {
      state.ratedList = payload.result;
    },
  },
  actions: {
    // 最受欢迎的请求
    getRatedListAsync({ commit }) {
      return new Promise((resolve) => {
        ratedApi().then((res) => {
          commit("getRatedList", res);
          resolve();
        });
      });
    },
  },
};
export default ratedModule;
